package com.onesports.intelligent.k12.polarlight.controller.wx.order;

import com.onesports.intelligent.k12.polarlight.common.utils.ResultUtil;
import com.onesports.intelligent.k12.polarlight.constant.ApiPathConstants;
import com.onesports.intelligent.k12.polarlight.domain.dto.wx.ServiceEvaluationADTO;
import com.onesports.intelligent.k12.polarlight.domain.vo.cls.CoachClassPageVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.product.WxOrderVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.product.WxProductVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.wx.WXFtbOrderByIdVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.wx.WXOrderByIdVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.wx.WxFtbOrderVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.wx.WxOFVO;
import com.onesports.intelligent.k12.polarlight.service.grade.ClassInfoService;
import com.onesports.intelligent.k12.polarlight.service.order.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author FPH
 * @since 2022年7月15日23:09:37
 */
@RestController
@Api(tags = "小程序端-订单")
@RequiredArgsConstructor
@RequestMapping(ApiPathConstants.WX_ORDER)
@PreAuthorize("hasAuthority('MINI_APP')")
public class WxOrderController {

    private final OrderService orderService;
    @ApiOperation("根据用户id查询全部订单信息")
    @GetMapping("/get-order")
    public ResponseEntity<List<WxOFVO>> getProduct() {
        return ResultUtil.success(orderService.getAllOrder());
    }
    @ApiOperation("根据用户id查询消费订单信息")
    @GetMapping("/get-order-consume")
    public ResponseEntity<List<WxOrderVO>> getOrder() {
        return ResultUtil.success(orderService.getWxOrder());
    }
    @ApiOperation("根据用户id查询充值订单信息")
    @GetMapping("/get-order-invest")
    public ResponseEntity<List<WxFtbOrderVO>> getFtbOrder() {
        return ResultUtil.success(orderService.getFtbOrder());
    }
    @ApiOperation("添加服务评价")
    @PostMapping("/insert-service-evaluation")
    public ResponseEntity<String> setServiceEvaluation(@RequestBody ServiceEvaluationADTO dto) {
        orderService.setServiceEvaluation(dto);
        return ResultUtil.success("添加成功！");
    }
    @ApiOperation("小程序-根据订单id查询消费订单信息")
    @GetMapping("/get-order-invest-by-id")
    public ResponseEntity<WXOrderByIdVO> getOrderAll(String orderId) {
        return ResultUtil.success(orderService.getOrderAll(orderId));
    }
    @ApiOperation("小程序-根据订单id查询充值订单信息")
    @GetMapping("/get-ftb-order-by-id")
    public ResponseEntity<WXFtbOrderByIdVO> getFtbOrderById(String tradeId) {
        return ResultUtil.success(orderService.getFtbOrderById(tradeId));
    }

}
